home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Mac Magazin/MacEasy 25
/
Mac Magazin and MacEasy Magazine CD - Issue 25.iso
/
Grafik & Text
/
Alpha
/
Tcl
/
Menus
/
internetConfigMenu.tcl
< prev
next >
Wrap
Text File
|
1996-08-15
|
3KB
|
120 lines
# nowrap
if $startingUp {
set icMenu "•139"
addMenu icMenu
return
}
set icMenu "•139"
proc icMenu {} {}
menu -n $icMenu -p internetProc {
"menu -n urls {}"
"/'<I<OpickUrl"
(-
goTo
help
(-
webBrowser
newsClient
mailClient
(-
ftpClient
gopherClient
telnetClient
(-
resolveUrl
viewHtmlFile
}
proc internetProc {menu item} {
global HOME
if {[catch {switch $item {
pickUrl icPickUrl
goTo icOpen
help {edit -r "$HOME:Help:Internet Config"}
webBrowser {launch -f [icGetPref -t 1 {helper•http}]}
mailClient {launch -f [icGetPref -t 1 {helper•mailto}]}
ftpClient {launch -f [icGetPref -t 1 {helper•ftp}]}
gopherClient {launch -f [icGetPref -t 1 {helper•gopher}]}
telnetClient {launch -f [icGetPref -t 1 {helper•telnet}]}
newsClient {launch -f [icGetPref -t 1 {helper•news}]}
resolveUrl {icURL [getSelect]}
viewHtmlFile htmlSendWindow
}}]} {
alertnote "Despite what Internet Config says, you should reboot after using IC for the first time."
launch -f "$HOME:Tools:Internet Config"
}
}
proc icPickUrl {} {
global savedUrls
if {![catch {listpick -p "Pick URL:" [lsort [array names savedUrls]]} res]} {
icURL $savedUrls($res)
}
}
proc rebuildUrlMenu {} {
global urlMenu savedUrls
menu -m -n urls -p urlProc {
"Add"
"View"
"Remove"
"(-"
}
foreach url [lsort -ignore [array names savedUrls]] {
addMenuItem -m -l " " urls $url
}
}
rebuildUrlMenu
# http://www.cs.umd.edu/~keleher/localHome.html
proc urlProc {menu item} {
global savedUrls modifiedArrVars
if {$item == "Add"} {
if {[catch getSelect def]} {set def {}}
set res [dialog -h 105 -w 370 -b OK 10 80 70 100 -b Cancel 100 80 160 100 -t {Name:} 10 10 60 30 -t {URL:} 10 40 60 60 -e "" 60 10 360 30 -e $def 60 40 360 60 ]
if {[lindex $res 0]} {
set nm [lindex $res 2]
set t [lindex $res 3]
if {![string length $t] || ![string length $nm]} {
beep
return
}
set savedUrls($nm) $t
lappend modifiedArrVars savedUrls
rebuildUrlMenu
}
} elseif {$item == "Remove"} {
set r [listpick -p "Remove which URL?" [lsort [array names savedUrls]]]
unset savedUrls($r)
removeArrDef savedUrls $r
rebuildUrlMenu
} elseif {$item == "View"} {
if {[info exists savedUrls]} {
set lines {}
foreach nm [array names savedUrls] {
append lines [format "%-20s \"%s\"\r" $nm [set savedUrls($nm)]]
}
new -n {* Saved URLs *}
insertText $lines
shrinkWindow
setWinInfo dirty 0
setWinInfo read-only 1
}
} else {
icURL [set savedUrls($item)]
}
}